package com.yanqu.road.server.timer;

import com.yanqu.road.server.manger.log.AutoLogMgr;
import com.yanqu.road.utils.executor.GeneralTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


public class AutoLogSaveTask extends GeneralTask {
    private static Logger logger = LogManager.getLogger(AutoLogSaveTask.class);
    private static boolean running = false;

    @Override
    public void doRun() {
        if (!running) {
            running = true;
            try {
                AutoLogMgr.save();
                AutoLogMgr.saveMysql();
                // 发送clickhouse日志
                AutoLogMgr.sendCKLog();
            } catch (Exception e) {
                logger.error("save AutoLogSaveTask error. ",e);
            }finally {
                running = false;
            }
        }
    }
}
